

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>5.3. UCTB.model_unit package &mdash; UCTB  documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
        <link rel="index" title="Index"
              href="genindex.html"/>
        <link rel="search" title="Search" href="search.html"/>
    <link rel="top" title="UCTB  documentation" href="index.html"/>
        <link rel="up" title="5. API Reference" href="APIReference.html"/>
        <link rel="next" title="5.4. UCTB.model package" href="UCTB.model.html"/>
        <link rel="prev" title="5.2. UCTB.preprocess package" href="UCTB.preprocess.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

   
  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> UCTB
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <ul>
<li class="toctree-l1"><a class="reference internal" href="md_file/introduction.html">1. Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/installation.html">2. Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/quickstart.html">3. Quick start</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/tutorial.html">4. Tutorial</a></li>
<li class="toctree-l1"><a class="reference internal" href="APIReference.html">5. API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="md_file/all_results.html">6. Results on different datasets</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">UCTB</a>
        
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          













<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
          <li><a href="APIReference.html">5. API Reference</a> &raquo;</li>
        
      <li>5.3. UCTB.model_unit package</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/UCTB.model_unit.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="uctb-model-unit-package">
<h1>5.3. UCTB.model_unit package<a class="headerlink" href="#uctb-model-unit-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-UCTB.model_unit.BaseModel">
<span id="uctb-model-unit-basemodel-module"></span><h2>5.3.1. UCTB.model_unit.BaseModel module<a class="headerlink" href="#module-UCTB.model_unit.BaseModel" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="UCTB.model_unit.BaseModel.BaseModel">
<em class="property">class </em><code class="sig-prename descclassname">UCTB.model_unit.BaseModel.</code><code class="sig-name descname">BaseModel</code><span class="sig-paren">(</span><em class="sig-param">code_version</em>, <em class="sig-param">model_dir</em>, <em class="sig-param">gpu_device</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="simple">
<dt>BaseModel is the base class for many models, such as STMeta, ST-MGCN and ST_ResNet,</dt><dd><p>you can also build your own model using this class. More information can be found in tutorial.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>code_version</strong> – Current version of this model code, which will be used as filename for saving the model.</p></li>
<li><p><strong>model_dir</strong> – The directory to store model files. Default:’model_dir’.</p></li>
<li><p><strong>gpu_device</strong> – To specify the GPU to use. Default: ‘0’.</p></li>
</ul>
</dd>
</dl>
<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.build">
<code class="sig-name descname">build</code><span class="sig-paren">(</span><em class="sig-param">init_vars=True</em>, <em class="sig-param">max_to_keep=5</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.build" title="Permalink to this definition">¶</a></dt>
<dd><dl class="simple">
<dt>Args</dt><dd><p>init_vars(bool): auto init the parameters if set to True, else no parameters will be initialized.
max_to_keep: max file to keep, which equals to max_to_keep in tf.train.Saver.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.close">
<code class="sig-name descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the session, release memory.</p>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.fit">
<code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">sequence_length</em>, <em class="sig-param">output_names=('loss'</em>, <em class="sig-param">)</em>, <em class="sig-param">op_names=('train_op'</em>, <em class="sig-param">)</em>, <em class="sig-param">evaluate_loss_name='loss'</em>, <em class="sig-param">batch_size=64</em>, <em class="sig-param">max_epoch=10000</em>, <em class="sig-param">validate_ratio=0.1</em>, <em class="sig-param">shuffle_data=True</em>, <em class="sig-param">early_stop_method='t-test'</em>, <em class="sig-param">early_stop_length=10</em>, <em class="sig-param">early_stop_patience=0.1</em>, <em class="sig-param">verbose=True</em>, <em class="sig-param">save_model=True</em>, <em class="sig-param">save_model_name=None</em>, <em class="sig-param">auto_load_model=True</em>, <em class="sig-param">return_outputs=False</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.fit" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sequence_length</strong> – int, the sequence length which is use in mini-batch training</p></li>
<li><p><strong>output_names</strong> – list, [output_tensor1_name, output_tensor1_name, …]</p></li>
<li><p><strong>op_names</strong> – list, [operation1_name, operation2_name, …]</p></li>
<li><p><strong>evaluate_loss_name</strong> – str, should be on of the output_names, evaluate_loss_name was use in
early-stopping</p></li>
<li><p><strong>batch_size</strong> – int, default 64, batch size</p></li>
<li><p><strong>max_epoch</strong> – int, default 10000, max number of epochs</p></li>
<li><p><strong>validate_ratio</strong> – float, default 0.1, the ration of data that will be used as validation dataset</p></li>
<li><p><strong>shuffle_data</strong> – bool, default True, whether shuffle data in mini-batch train</p></li>
<li><p><strong>early_stop_method</strong> – should be ‘t-test’ or ‘naive’, both method are explained in train.EarlyStopping</p></li>
<li><p><strong>early_stop_length</strong> – int, must provide when early_stop_method=’t-test’</p></li>
<li><p><strong>early_stop_patience</strong> – int, must provide when early_stop_method=’naive’</p></li>
<li><p><strong>verbose</strong> – Bool, flag to print training information or not</p></li>
<li><p><strong>save_model</strong> – Bool, flog to save model or not</p></li>
<li><p><strong>save_model_name</strong> – String, filename for saving the model, which will overwrite the code_version.</p></li>
<li><p><strong>auto_load_model</strong> – Bool, the “fit” function will automatically load the model from disk, if exists,
before the training. Set to False to disable the auto-loading.</p></li>
<li><p><strong>return_outputs</strong> – Bool, set True to return the training log, otherwise nothing will be returned</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.load">
<code class="sig-name descname">load</code><span class="sig-paren">(</span><em class="sig-param">subscript</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.load" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>subscript</strong> – String, subscript will be appended to the code version as the model file name,
and load the corresponding model using this filename</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.load_event_scalar">
<code class="sig-name descname">load_event_scalar</code><span class="sig-paren">(</span><em class="sig-param">scalar_name='val_loss'</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.load_event_scalar" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>scalar_name</strong> – load the corresponding scalar name from tensorboard-file,
e.g. load_event_scalar(‘val_loss)</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.predict">
<code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param">sequence_length</em>, <em class="sig-param">output_names=('prediction'</em>, <em class="sig-param">)</em>, <em class="sig-param">cache_volume=64</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.predict" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output_names</strong> – list, [output_tensor_name1, output_tensor_name2, …]</p></li>
<li><p><strong>sequence_length</strong> – int, the length of sequence, which is use in mini-batch training</p></li>
<li><p><strong>cache_volume</strong> – int, default 64, we need to set cache_volume if the cache can not hold
the whole validation dataset</p></li>
</ul>
</dd>
</dl>
<p>:param : return: outputs_dict: dict, like {output_tensor1_name: output_tensor1_value, …}</p>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.BaseModel.BaseModel.save">
<code class="sig-name descname">save</code><span class="sig-paren">(</span><em class="sig-param">subscript</em>, <em class="sig-param">global_step</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.BaseModel.BaseModel.save" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>subscript</strong> – String, subscript will be appended to the code version as the model filename,
and save the corresponding model using this filename</p></li>
<li><p><strong>global_step</strong> – Int, current training steps</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-UCTB.model_unit.DCRNN_CELL">
<span id="uctb-model-unit-dcrnn-cell-module"></span><h2>5.3.2. UCTB.model_unit.DCRNN_CELL module<a class="headerlink" href="#module-UCTB.model_unit.DCRNN_CELL" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="UCTB.model_unit.DCRNN_CELL.DCGRUCell">
<em class="property">class </em><code class="sig-prename descclassname">UCTB.model_unit.DCRNN_CELL.</code><code class="sig-name descname">DCGRUCell</code><span class="sig-paren">(</span><em class="sig-param">num_units</em>, <em class="sig-param">input_dim</em>, <em class="sig-param">num_graphs</em>, <em class="sig-param">supports</em>, <em class="sig-param">max_diffusion_step</em>, <em class="sig-param">num_nodes</em>, <em class="sig-param">num_proj=None</em>, <em class="sig-param">activation=&lt;function tanh&gt;</em>, <em class="sig-param">reuse=None</em>, <em class="sig-param">use_gc_for_ru=True</em>, <em class="sig-param">name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.DCRNN_CELL.DCGRUCell" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">tensorflow.python.ops.rnn_cell_impl.RNNCell</span></code></p>
<p>Graph Convolution Gated Recurrent Unit cell.</p>
<dl class="method">
<dt id="UCTB.model_unit.DCRNN_CELL.DCGRUCell.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.DCRNN_CELL.DCGRUCell.call" title="Permalink to this definition">¶</a></dt>
<dd><p>This is where the layer’s logic lives.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> – Input tensor, or list/tuple of input tensors.</p></li>
<li><p><strong>**kwargs</strong> – Additional keyword arguments.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A tensor or list/tuple of tensors.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.DCRNN_CELL.DCGRUCell.compute_output_shape">
<code class="sig-name descname">compute_output_shape</code><span class="sig-paren">(</span><em class="sig-param">input_shape</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.DCRNN_CELL.DCGRUCell.compute_output_shape" title="Permalink to this definition">¶</a></dt>
<dd><p>Computes the output shape of the layer.</p>
<p>Assumes that the layer will be built
to match that input shape provided.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>input_shape</strong> – Shape tuple (tuple of integers)
or list of shape tuples (one per output tensor of the layer).
Shape tuples can include None for free dimensions,
instead of an integer.</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>An input shape tuple.</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.DCRNN_CELL.DCGRUCell.output_size">
<em class="property">property </em><code class="sig-name descname">output_size</code><a class="headerlink" href="#UCTB.model_unit.DCRNN_CELL.DCGRUCell.output_size" title="Permalink to this definition">¶</a></dt>
<dd><p>size of outputs produced by this cell.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>Integer or TensorShape</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.DCRNN_CELL.DCGRUCell.state_size">
<em class="property">property </em><code class="sig-name descname">state_size</code><a class="headerlink" href="#UCTB.model_unit.DCRNN_CELL.DCGRUCell.state_size" title="Permalink to this definition">¶</a></dt>
<dd><p>size(s) of state(s) used by this cell.</p>
<p>It can be represented by an Integer, a TensorShape or a tuple of Integers
or TensorShapes.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-UCTB.model_unit.GraphModelLayers">
<span id="uctb-model-unit-graphmodellayers-module"></span><h2>5.3.3. UCTB.model_unit.GraphModelLayers module<a class="headerlink" href="#module-UCTB.model_unit.GraphModelLayers" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="UCTB.model_unit.GraphModelLayers.GAL">
<em class="property">class </em><code class="sig-prename descclassname">UCTB.model_unit.GraphModelLayers.</code><code class="sig-name descname">GAL</code><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GAL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>This class provides static methods for adding Graph Attention Layer.</p>
<dl class="method">
<dt id="UCTB.model_unit.GraphModelLayers.GAL.add_ga_layer_matrix">
<em class="property">static </em><code class="sig-name descname">add_ga_layer_matrix</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">units</em>, <em class="sig-param">num_head</em>, <em class="sig-param">activation=&lt;function tanh&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GAL.add_ga_layer_matrix" title="Permalink to this definition">¶</a></dt>
<dd><p>This method use Multi-head attention technique to add Graph Attention Layer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>input</strong> (<em>ndarray</em>) – The set of node features data, with shape [batch, num_node, num_featuer].</p></li>
<li><p><strong>unit</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – The number of merge_gal_units used in GAL.</p></li>
<li><p><strong>num_head</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – The number of multi-head used in GAL.</p></li>
<li><p><strong>activation</strong> (<em>function</em>) – activation function. default:tf.nn.tanh.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>The weight matrix after softmax function.
gc_output: The final GAL aggregated feature representation from input feature.</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p>alpha</p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.GraphModelLayers.GAL.add_residual_ga_layer">
<em class="property">static </em><code class="sig-name descname">add_residual_ga_layer</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">units</em>, <em class="sig-param">num_head</em>, <em class="sig-param">activation=&lt;function tanh&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GAL.add_residual_ga_layer" title="Permalink to this definition">¶</a></dt>
<dd><p>Call the add_ga_layer_matrix function to build the Graph Attention Layer,
and add the residual layer to optimize the deep neural network.</p>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.GraphModelLayers.GAL.attention_merge_weight">
<em class="property">static </em><code class="sig-name descname">attention_merge_weight</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">units</em>, <em class="sig-param">num_head</em>, <em class="sig-param">activation=&lt;function leaky_relu&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GAL.attention_merge_weight" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="UCTB.model_unit.GraphModelLayers.GCL">
<em class="property">class </em><code class="sig-prename descclassname">UCTB.model_unit.GraphModelLayers.</code><code class="sig-name descname">GCL</code><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GCL" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>This class provides static methods for adding Graph Convolution Layer.</p>
<dl class="method">
<dt id="UCTB.model_unit.GraphModelLayers.GCL.add_gc_layer">
<em class="property">static </em><code class="sig-name descname">add_gc_layer</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">gcn_k</em>, <em class="sig-param">laplacian_matrix</em>, <em class="sig-param">output_size</em>, <em class="sig-param">dtype=tf.float32</em>, <em class="sig-param">use_bias=True</em>, <em class="sig-param">trainable=True</em>, <em class="sig-param">initializer=None</em>, <em class="sig-param">regularizer=None</em>, <em class="sig-param">activation=&lt;function tanh&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GCL.add_gc_layer" title="Permalink to this definition">¶</a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>Input</strong> (<em>ndarray</em>) – The input features with shape [batch, num_node, num_feature].</p></li>
<li><p><strong>gcn_k</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – The highest order of Chebyshev Polynomial approximation in GCN.</p></li>
<li><p><strong>laplacian_matrix</strong> (<em>ndarray</em>) – Laplacian matrix used in GCN, with shape [num_node, num_node].</p></li>
<li><p><strong>output_size</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – Number of output channels.</p></li>
<li><p><strong>dtype</strong> – Data type. default:tf.float32.</p></li>
<li><p><strong>use_bias</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><em>bool</em></a>) – It determines whether to add bias in the output. default:True.</p></li>
<li><p><strong>trainable</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#bool" title="(in Python v3.9)"><em>bool</em></a>) – It determines whether <cite>weights</cite> tensor can be trained. default:True.</p></li>
<li><p><strong>initializer</strong> – It determines whether the “weight” tensor is initialized. default:None.</p></li>
<li><p><strong>regularizer</strong> – It determines whether the “weight” tensor is regularized. default:None.</p></li>
<li><p><strong>activation</strong> (<em>function</em>) – activation function. default:tf.nn.tanh.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>Returns the result of convolution of <cite>inputs</cite> and <cite>laplacian_matrix</cite></p>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="UCTB.model_unit.GraphModelLayers.GCL.add_multi_gc_layers">
<em class="property">static </em><code class="sig-name descname">add_multi_gc_layers</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">gcn_k</em>, <em class="sig-param">gcn_l</em>, <em class="sig-param">output_size</em>, <em class="sig-param">laplacian_matrix</em>, <em class="sig-param">activation=&lt;function tanh&gt;</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.GraphModelLayers.GCL.add_multi_gc_layers" title="Permalink to this definition">¶</a></dt>
<dd><p>Call add_gc_layer function to add multi Graph Convolution Layer.`gcn_l` is the number of layers added.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-UCTB.model_unit.ST_RNN">
<span id="uctb-model-unit-st-rnn-module"></span><h2>5.3.4. UCTB.model_unit.ST_RNN module<a class="headerlink" href="#module-UCTB.model_unit.ST_RNN" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="UCTB.model_unit.ST_RNN.GCLSTMCell">
<em class="property">class </em><code class="sig-prename descclassname">UCTB.model_unit.ST_RNN.</code><code class="sig-name descname">GCLSTMCell</code><span class="sig-paren">(</span><em class="sig-param">units</em>, <em class="sig-param">num_nodes</em>, <em class="sig-param">laplacian_matrix</em>, <em class="sig-param">gcn_k=1</em>, <em class="sig-param">gcn_l=1</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.ST_RNN.GCLSTMCell" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">tensorflow.python.keras.layers.recurrent.LSTMCell</span></code></p>
<p>GCLSTMCell is one of our implemented ST-RNN models in handling the spatial and temporal features.
We performed GCN on both LSTM inputs and hidden-states. The code is inherited from tf.keras.layers.LSTMCell,
thus it can be used almost the same as LSTMCell except that you need to provide the GCN parameters
in the __init__ function.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>units</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – number of units of LSTM</p></li>
<li><p><strong>num_nodes</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – number of nodes in the graph</p></li>
<li><p><strong>laplacian_matrix</strong> (<em>ndarray</em>) – laplacian matrix used in GCN, with shape [num_node, num_node]</p></li>
<li><p><strong>gcn_k</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – highest order of Chebyshev Polynomial approximation in GCN</p></li>
<li><p><strong>gcn_l</strong> (<a class="reference external" href="https://docs.python.org/3/library/functions.html#int" title="(in Python v3.9)"><em>int</em></a>) – number of GCN layers</p></li>
<li><p><strong>kwargs</strong> – other parameters supported by LSTMCell, such as activation, kernel_initializer … and so on.</p></li>
</ul>
</dd>
</dl>
<dl class="method">
<dt id="UCTB.model_unit.ST_RNN.GCLSTMCell.call">
<code class="sig-name descname">call</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">states</em>, <em class="sig-param">training=None</em><span class="sig-paren">)</span><a class="headerlink" href="#UCTB.model_unit.ST_RNN.GCLSTMCell.call" title="Permalink to this definition">¶</a></dt>
<dd><p>This is where the layer’s logic lives.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputs</strong> – Input tensor, or list/tuple of input tensors.</p></li>
<li><p><strong>**kwargs</strong> – Additional keyword arguments.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>A tensor or list/tuple of tensors.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

</div>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="UCTB.model.html" class="btn btn-neutral float-right" title="5.4. UCTB.model package" accesskey="n">Next →</a>
      
      
        <a href="UCTB.preprocess.html" class="btn btn-neutral" title="5.2. UCTB.preprocess package" accesskey="p">← Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2019, UCTB group.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE: 'true'
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>
      <script type="text/javascript" src="_static/language_data.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>